diff options
| author | Adam Soltys <[email protected]> | 2023-12-06 20:33:45 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-12-06 20:33:45 -0800 |
| commit | 6b3ff247e4125941a611369ed9bb74a2ffca57d8 (patch) | |
| tree | 91da939350398188834e5e002bc78011a2a8e5bf /src/routes/(app)/fund/[id]/+page.server.js | |
| parent | bb59ac3e4e7fcbf7f8a48820eab0ee21558183fc (diff) | |
| parent | d69c34cf389639eac82d24d1f1b02f038ef42399 (diff) | |
| download | coinos-ui-6b3ff247e4125941a611369ed9bb74a2ffca57d8.tar.gz coinos-ui-6b3ff247e4125941a611369ed9bb74a2ffca57d8.zip | |
Merge branch 'master' into swapee
Diffstat (limited to 'src/routes/(app)/fund/[id]/+page.server.js')
| -rw-r--r-- | src/routes/(app)/fund/[id]/+page.server.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/routes/(app)/fund/[id]/+page.server.js b/src/routes/(app)/fund/[id]/+page.server.js new file mode 100644 index 00000000..6c5c943f --- /dev/null +++ b/src/routes/(app)/fund/[id]/+page.server.js @@ -0,0 +1,23 @@ +import { error, redirect } from "@sveltejs/kit"; +import { auth, get, post } from "$lib/utils"; +import Qr from "qrcode-base64"; + +export let load = async ({ params: { id }, url }) => { + let { amount, payments } = await get(`/fund/${id}`); + + let src = Qr.drawImg(url.href, { size: 300 }); + return { amount, payments, src }; +}; + +export const actions = { + default: async ({ cookies, locals, params, request }) => { + let { user } = locals; + + if (user) { + await post("/redeem", params, auth(cookies)); + throw redirect(307, `/${user.username}/payments`); + } + + throw redirect(307, "/register"); + }, +}; |
